package com.zhangjun.spring;

import com.zhangjun.spring.entity.Student;
import com.zhangjun.spring.entity.Teacher;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


/**
 * @author 张钧
 * @Description
 * @create 2022-09-16 19:46
 */
public class Test1 {

    public static void main(String[] args) {
        // 1.加载spring配置文件
        ApplicationContext context = new ClassPathXmlApplicationContext("ApplicationContext.xml");
        // 2.获取配置创建的对象
        Teacher teacher = (Teacher) context.getBean("teacher");
        Student student = (Student) context.getBean("student");
        System.out.println(teacher.teach(student));
    }
}
